function d_pos=def_delta_pos_func(G,P,k)
% def_delta_pos_func: Default subroutine to update P.pos via P.ang and P.speed
%
% SYNTAX:
%   d_pos = def_delta_ang_func(G,P,k)
%   Return value d_pos is the desired position increment in current game step.

%   Author: Hongbin Ma
%   Last updated: 2009-6-1 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

d_ang=zeros(1,length(P.ang));
switch length(P.pos)
case 2
d_pos=P.speed*G.h*[cos(P.ang),sin(P.ang)];
case 3
d_pos=P.speed*G.h*[cos(P.ang(1)),sin(P.ang(1))*cos(P.ang(2)),sin(P.ang(1))*sin(P.ang(2))];
otherwise
alert_error_pos(P.pos);
end;

